﻿#ifndef CONFIG_H
#define CONFIG_H

#include <QSettings>
#include <QString>
#include <QVariant>
#include <QJsonObject>
#include "../utils/Singleton.h"

class Configger : public Singleton<Configger>
{
    friend class Singleton<Configger>;

public:
    bool init();
    QVariant get(const QString& key, const QVariant& defaultValue = QVariant());
    void set(const QString& key, const QVariant& value);
    void remove(const QString& key);
    bool save();

private:
    Configger(QObject* parent = nullptr){};
    QString configFilePath() const;

    QJsonObject _configData;
    bool _initialized = false;
};
#endif
